package com.company.ListNodeLk;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class LK82 {
    public static void main(String[] args) {

    }
    public ListNode deleteDuplicates(ListNode head) {
        HashSet<Integer> hashSet1 = new HashSet<>();
        HashSet<Integer> hashSet2 = new HashSet<>();
        while(head!=null){
            if(hashSet1.contains(head.val)){
                hashSet2.add(head.val);
            }else{
                hashSet1.add(head.val);
            }
            head = head.next;
        }
        List<Integer> list = new ArrayList<>(hashSet2);




        return head;
    }
}
